﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Asset_Manager
{

    public partial class frmLogin : Form
    {
        bool isValid = false;
        public frmLogin(ServiceReference1.User user)
        {
            InitializeComponent();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        //login prestub. no idea what this will entail.
        private void btnLogin_Click(object sender, EventArgs e)
        {
            // Set cursor as hourglass
            Cursor.Current = Cursors.WaitCursor;
            
            //string UN, PW;
            ////TODO INPUT SANITATION AND VERIFICATION 
            //UN = txtUserName.Text.ToString();
            //PW = txtPassword.Text.ToString();
            //opens reference
            
            ServiceReference1.Service1Client lg = new ServiceReference1.Service1Client();
            //isValid = 
                
            lg.Login(txtUserName.Text, txtPassword.Text);
            //frmMDIMain._user = lg.Login(UN, PW);
            if (isValid != true)
            {
                Application.Exit();
            }
            else
            {
                this.Close();
            }
            Cursor.Current = Cursors.Default;

            this.Close();
        }

        private void btnRegister_Click(object sender, EventArgs e)
        {
            string UN, PW;
            //TODO INPUT SANITATION AND VERIFICATION 
            UN = txtUserName.Text.ToString();
            PW = txtPassword.Text.ToString();

            ServiceReference1.Service1Client lg = new ServiceReference1.Service1Client();
            //lg.EnterUser(UN, PW);
 
           
        }
    }
}
